


  //检查环节评分数据
  function nodeSatisfiablityCheckData() {

     var satReasonNames=document.getElementsByName("satReasonName");
     var scores=document.getElementsByName("score");
     var reasons=document.getElementsByName("reason");
     var nodeNames=document.getElementsByName("parnetNodeName");
     var satisfiabilityIds=document.getElementsByName("satisfiabilityId"); 
     
     var remarkLength=document.getElementsByName("remarkLength");
     var baseScore=document.getElementsByName("baseScore");	
     var bottomScore=document.getElementsByName("bottomScore");
     var saID=document.getElementsByName("saID"); 

     for(i=0;i<satisfiabilityIds.length;i++){
       for(j=0;j<saID.length;j++){  
       	  if(saID[j].value==satisfiabilityIds[i].value){      
       	    current=j;
       	  }
       	}
     
     if(satisfiabilityIds[i].value==""){
        alert("请选择环节 【"+nodeNames[i].value+"】 的评价。"); 
        return false;
     } 
     if(scores[i].value==""){
        alert("请填写环节 【"+nodeNames[i].value+"】 的评分。"); 
        return false;
     }
     if(isNaN(scores[i].value) || scores[i].value==""){
        alert("请正确填写环节 【"+nodeNames[i].value+"】 的评分。");   
        return false;
     }else{
       scoreInt=parseInt(scores[i].value);  
       	    if(scoreInt>baseScore[current].value || scoreInt<bottomScore[current].value) {
       	    	alert("请正确填写环节 【"+nodeNames[i].value+"】 的评分范围（"+bottomScore[current].value+"分～"+baseScore[current].value+"分）。");
       	    	return false;
       	    }
     }
     
     if(satisfiabilityIds[i].value==""){
        alert("请选择环节 【"+nodeNames[i].value+"】 的评分理由。");
        return false;
     }

     if(reasons[i].value=="" && remarkLength[current].value !="0"){
        alert("请正确填写环节 【"+nodeNames[i].value+"】 的操作说明。");
        return false;
     }else{     
       	    if(reasons[i].value.length<remarkLength[current].value && remarkLength[current].value !="0") {
       	    	alert("环节 【"+nodeNames[i].value+"】 的操作说明不能少于"+remarkLength[current].value+"字。");
       	    	return false;
       	    }
       	if(reasons[i].value.length>300){
       	  alert("环节 【"+nodeNames[i].value+"】 的操作说明不能超过300个字。");
       	  return false;
       	}
      }
     }
     return true;
  }
  
  function setReason(hit,rsnId, reason) {
     var outstr="";
     var tmpstr="";
     var satReasonNames=document.all("satReasonName"+hit);
     var satReasonIds=document.all("satReasonId");
     try{ 
     	 if(satReasonIds.length){ 
		     for(i=0;i<satReasonIds.length;i++){
		       if(i==hit){
		         for(j=0;j<reason.length;j++){
		           tmpstr=reason[j];           
		           if(tmpstr!=null){
		              if(outstr==""){         
		                  outstr="<table width=\"70%\" class=\"columnTable\" cellspacing=\"1\"><tr class=\"columnInput\"><td>"+tmpstr+"</td></tr>";
		              }else{         
		                  outstr=outstr+"<tr  class=\"columnInput\"><td>"+tmpstr+"</td></tr>";
		              }
		           }     
		         }
		         satReasonNames.innerHTML=outstr+"</table>";
		         //satReasonNames[i].value=reason;
		         satReasonIds[i].value=rsnId;
		       }
		     }
	     }else{ 
     	 	var i=0;
	         for(j=0;j<reason.length;j++){
	           tmpstr=reason[j];           
	           if(tmpstr!=null){
	              if(outstr==""){         
	                  outstr="<table width=\"70%\" class=\"columnTable\" cellspacing=\"1\"><tr class=\"columnInput\"><td>"+tmpstr+"</td></tr>";
	              }else{         
	                  outstr=outstr+"<tr  class=\"columnInput\"><td>"+tmpstr+"</td></tr>";
	              }
	           }     
	         } 
	         satReasonNames.innerHTML=outstr+"</table>";
	         //satReasonNames[i].value=reason;
	         satReasonIds.value=rsnId; 
	     }
     } catch(e){
     	 try{
     	 alert();
     	 }catch(e){
     	 }
     }
  }  
  
  function getNums(idStr) {  
    var nums=new Array();
    var numStr=	idStr.substring(idStr.indexOf("@"),idStr.length);  
    markLength=numStr.substring(1,numStr.indexOf("#"));
    nums[0]=markLength;    
    baseScore=numStr.substring(numStr.indexOf("#")+1,numStr.indexOf("$"));
    nums[1]=baseScore; 
    bottmScore=numStr.substring(numStr.indexOf("$")+1,numStr.length);                  
  }    
  
  function showText(num){  
                      
     var remarkLength=document.getElementsByName("remarkLength");
     var baseScore=document.getElementsByName("baseScore");	
     var bottomScore=document.getElementsByName("bottomScore"); 
     var saID=document.getElementsByName("saID");
     
     var scoreStr=document.getElementsByName("scoreStr");
     var reasonStr=document.getElementsByName("reasonStr"); 
     var satisfiabilityIds=document.getElementsByName("satisfiabilityId"); 

     for(i=0;i<remarkLength.length;i++){  
         
        if(satisfiabilityIds[num].value==saID[i].value){ 
           scoreStr[num].value="(请输入"+bottomScore[i].value+"～"+baseScore[i].value+"之间的分值)";  
           reasonStr[num].value="(请输入至少"+remarkLength[i].value+"字操作说明.)";  
        }   
     }
  }
  
  //默认环节评分理由  satValue：满意度ID，reasonValue：操作理由，reasonID：操作理由ID
  //bottomS：最低分，baseS：最高分，remarkL:操作说明字长,num ：第几个评分控件
  function showDef(satValue,reasonValue,reasonID,bottomS,baseS,remarkL,num){
     var satReasonNames=document.all("satReasonName"+num);
     var scores=document.getElementsByName("score");
     var reasons=document.getElementsByName("reason");
     var reasonIDs = document.getElementsByName("satReasonId");

     var satisfiabilityIds=document.getElementsByName("satisfiabilityId"); 
   
     
     var scoreStr=document.getElementsByName("scoreStr");
     var reasonStr=document.getElementsByName("reasonStr"); 
     
     satisfiabilityIds[num].value=satValue;
     scores[num].value=bottomS;
     //satReasonNames[num].value=reasonValue+',';
     satReasonNames.innerHTML='<table width=\"70%\" class=\"columnTable\" cellspacing=\"1\"><tr class=\"columnInput\"><td>'+reasonValue+'</td></tr></table>';
     reasonIDs[num].value=reasonID+'#@';
     scoreStr[num].value="(请输入"+bottomS+"～"+baseS+"之间的分值)";  
     reasonStr[num].value="(请输入至少"+remarkL+"字操作说明.)";  
  }
  
  function setOverTimeReason(rsnId, reason) {   
     var outstr="";
     var tmpstr="";
     var setReasonNames=document.all("setOverTimeReasonName");
     var setReasonIds=document.all("setOverTimeReasonId");
	 
         for(j=0;j<reason.length;j++){
           tmpstr=reason[j];           
           if(tmpstr!=null){
              if(outstr==""){         
                  outstr="<table width=\"70%\" class=\"columnTable\" cellspacing=\"1\"><tr class=\"columnInput\"><td>"+tmpstr+"</td></tr>";
              }else{         
                  outstr=outstr+"<tr  class=\"columnInput\"><td>"+tmpstr+"</td></tr>";
              }
           }      
         setReasonNames.innerHTML=outstr+"</table>";  
         setReasonIds.value=rsnId;   
       } 
  }  
  function setFlowOverTimeReason(rsnId, reason) {   
     var outstr="";
     var tmpstr="";
     var setReasonNames=document.all("setFlowOverTimeReasonName");
     var setReasonIds=document.all("setFlowOverTimeReasonId");
	 
         for(j=0;j<reason.length;j++){
           tmpstr=reason[j];           
           if(tmpstr!=null){
              if(outstr==""){         
                  outstr="<table width=\"70%\" class=\"columnTable\" cellspacing=\"1\"><tr class=\"columnInput\"><td>"+tmpstr+"</td></tr>";
              }else{         
                  outstr=outstr+"<tr  class=\"columnInput\"><td>"+tmpstr+"</td></tr>";
              }
           }      
         setReasonNames.innerHTML=outstr+"</table>";  
         setReasonIds.value=rsnId;   
       } 
  }  